var app = angular.module("myApp",[]);

app.controller("myCtrl",function($scope,$http){
	$scope.reminder = false;
	$scope.close = function(){
	    $scope.reminder = false;
	}
	//点击跳到搜索记录页面
	$scope.toSearch = function(){
		window.location.href = "search_record.html";
	}
	//点击跳到购物车
	$scope.toCart = function(){
		window.location.href = "shoppingCart.html";
	}
    
    $scope.checkOrder = function(){
    	if(window.sessionStorage.login == "true"){
    		window.sessionStorage.http = window.location.href;
    		location.href="my_order.html?type=all";
    	}else{
    		$scope.reminder = true;
    		$scope.message = "您未登录，请先登录！";
    	}
    }
    
    $scope.checkPersonal = function(){
    	if(window.sessionStorage.login == "true"){
    		location.href="personal_information.html";
    	}else{
    		$scope.reminder = true;
    		$scope.message = "您未登录，请先登录！";
    	}
    }
    
	$scope.educationList = $scope.emergencyList = $scope.infoList = [];
	
	$http({
        method : "get",
        dataType: "json",
		withCredentials: true,	//跨域名请求。XHR：XMLHttpRequest (XHR) ，基于XML技术的Http请求
	    crossDomain: true,
	    contentType: "application/json",
        async:true,
        url : host + "/homePage/getOtherInfo"
    }).success(function(response){
        if(response.code == 2000){
        	$scope.educationList = response.data.educationList;
        	$scope.emergencyList = response.data.emergencyList;
        	$scope.infoList = response.data.infoList;
        }
    });
})
